package controller.startup
{
	import org.robotlegs.base.ContextEvent;
	import org.robotlegs.mvcs.StarlingCommand;
	
	import view.event.main.ApplicationEvent;
	
	
	/**
	 * 整个应用起动的command，用于初始化robotlegs相关的模块
	 * @author £iang
	 * 
	 */	
	public class StartUpCommand extends StarlingCommand
	{
		//-----------------------------
		// variables
		//-----------------------------
		
		/** 启动事件 */
		[Inject]
		public var event : ContextEvent;
		
		//-----------------------------
		// properties
		//-----------------------------
		
		//-----------------------------
		// setter&getter
		//-----------------------------
		
		//-----------------------------
		// methods
		//-----------------------------
		
		/**
		 * 接收到事件后，command从这里开始执行
		 * 
		 */
		override public function execute():void 
		{
			commandMap.mapEvent( ApplicationEvent.CONFIG_CONTROLLER, ConfigControllerCommand, ApplicationEvent, true );
			commandMap.mapEvent( ApplicationEvent.CONFIG_SERVICE, ConfigServiceCommand, ApplicationEvent, true );
			commandMap.mapEvent( ApplicationEvent.CONFIG_MODEL, ConfigModelCommand, ApplicationEvent, true );
			commandMap.mapEvent( ApplicationEvent.CONFIG_VIEW, ConfigViewCommand, ApplicationEvent, true );
			
			
			
			dispatch( new ApplicationEvent( ApplicationEvent.CONFIG_CONTROLLER ) );
		}
		
		//-----------------------------
		// events
		//-----------------------------
		
		//-----------------------------
		// dispose
		//-----------------------------
		
	}
}